package com.learning.dynamic.executor.utils;

import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.client.config.NacosConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Wang Xu
 * @date 2023/11/7
 */
public class NacosConfigUtil {
    private static final Logger LOGGER = LoggerFactory.getLogger(NacosConfigUtil.class);

    public static String getByDataId(String dataId) {
        NacosConfigService bean = SpringBeanUtil.getBean(NacosConfigService.class);

        try {
            return bean.getConfig(dataId, "group-test1", 100);
        } catch (NacosException e) {
            LOGGER.error("nacos data query error, msg is :", e);
        }
        return null;
    }

}